package com.darrenchan

object ForDemo {
  def main(args: Array[String]): Unit = {
    val l = List("alice", "bob", "cathy")
    for {
      s <- l //generator
    } println(s)

    for {
      s <- l
      if s.length > 3 //filter
    } println(s)

    val for_result = for {
      s <- l
      s1 = s.toUpperCase()
      if(s1 != "")
    } yield (s1)
    println(for_result)
  }
}
